<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主控端控制管理后台登录页面</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/static/css/style.css" />
<link rel="stylesheet" type="text/css" href="/static/css/body.css" />
<script type="text/javascript" src="/static/template/js/jquery-3.4.1.min.js"></script>
<!-- layer -->
<script type="text/javascript" src="/static/js/layer/layer.js"></script>
</head>
<body>
	<div class="container">
		<section id="content">
		<form onsubmit="return false;" autocomplete="off">
			<h1>主控端登录</h1>
			<div>
				<input type="text" placeholder="账号" required="" id="username" />
			</div>
			<div>
				<input type="password" placeholder="密码" required="" id="password" />
			</div>
			<div class="">
				<span class="help-block u-errormessage" id="js-server-helpinfo">&nbsp;</span>
			</div>
			<div>
				<!-- <input type="submit" value="Log in" /> -->
				<input type="submit" value="登录" class="btn btn-primary" id="js-btn-login" />
				<!-- <a href="#">Register</a> -->
			</div>
		</form>
		<!-- form -->
		<div class="button">
			<span class="help-block u-errormessage" id="js-server-helpinfo">&nbsp;</span>
		</div>
		<!-- button --> </section>
		<!-- content -->
	</div>
	<!-- container -->
	<script>
		$(function() {
			if (window.parent.iframeRedirectLogin) {
				window.parent.iframeRedirectLogin();
			}

			$("#js-btn-login").click(function() {
				var username = $.trim($("#username").val());
				var password = $.trim($("#password").val());
				if (username === '' || password === '') {
					return;
				}
				$.post('/login', {
					username : username,
					password : password
				}, function(response) {
					if (response && response.data) {
						window.location.href = response.data;
						return;
					}
					if (response && response.message && response.message.message) {
						layer.ready(function() {
							layer.msg(response.message.message, {
								icon : 2,
								time : 2000
							});
						});

					}
				}, 'json');
			});
		});
	</script>
</body>
</html>